import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
};

const routes = [
    {
        path: "/AdminLogin",
        name: "AdminLogin",
        component: resolve => require(["../views/AdminLogin"], resolve),
        meta: {
            title: '宝鸡地震灾害风险调查工作软件平台'
        }
    },
    {
        path: "/", redirect: 'BuildingTl',
        component: resolve => require(["../views/Administrator.vue"], resolve),
        children: [
            {
                path: "/BuildingTl",
                name: "BuildingTl",
                component: resolve => require(["../modules/admin/building/tl/Tl"], resolve),
                meta: {
                    title: '建筑数据调查首页'
                }
            },
            {
                path: "/BuildingNewMission",
                name: "BuildingNewMission",
                component: resolve => require(["../modules/admin/building/tl/NewMission"], resolve),
                meta: {
                    title: '发布建筑数据调查任务'
                }
            },
            {
                path: "/BuildingNode",
                name: "BuildingNode",
                component: resolve => require(["../modules/admin/building/tl/Node"], resolve),
                meta: {
                    title: '建筑数据调查任务调查点数据'
                }
            },
            {
                path: "/BuildingHistory",
                name: "BuildingHistory",
                component: resolve => require(["../modules/admin/building/tl/HistoryList"], resolve),
                meta: {
                    title: '建筑数据调查任务上传历史'
                }
            },
            {
                path: "/BuildingQc",
                name: "BuildingQc",
                component: resolve => require(["../modules/admin/building/qc/DataQuality"], resolve),
                meta: {
                    title: '建筑数据调查数据质检页'
                }
            },
            {
                path: "/BuildingDi",
                name: "BuildingDi",
                component: resolve => require(["../modules/admin/building/di/DataRIU"], resolve),
                meta: {
                    title: '建筑数据调查数据入库记录'
                }
            },

            {
                path: "/WaterTl",
                name: "WaterTl",
                component: resolve => require(["../modules/admin/water/tl/Tl"], resolve),
                meta: {
                    title: '供水数据调查首页'
                }
            },
            {
                path: "/WaterNewMission",
                name: "WaterNewMission",
                component: resolve => require(["../modules/admin/water/tl/NewMission"], resolve),
                meta: {
                    title: '发布供水数据调查任务'
                }
            },
            {
                path: "/WaterNode",
                name: "WaterNode",
                component: resolve => require(["../modules/admin/water/tl/Node"], resolve),
                meta: {
                    title: '供水数据调查任务调查点信息'
                }
            },
            {
                path: "/WaterHistory",
                name: "WaterHistory",
                component: resolve => require(["../modules/admin/water/tl/HistoryList"], resolve),
                meta: {
                    title: '供水数据调查任务上传历史'
                }
            },
            {
                path: "/WaterQc",
                name: "WaterQc",
                component: resolve => require(["../modules/admin/water/qc/DataQuality"], resolve),
                meta: {
                    title: '供水数据调查任务数据质检页'
                }
            },
            {
                path: "/WaterBangQc",
                name: "WaterBangQc",
                component: resolve => require(["../modules/admin/water/qc/WaterBangQc"], resolve),
                meta: {
                    title: '水泵信息'
                }
            },
            {
                path: "/WaterPoolQc",
                name: "WaterPoolQc",
                component: resolve => require(["../modules/admin/water/qc/WaterPoolQc"], resolve),
                meta: {
                    title: '水池信息'
                }
            },
            {
                path: "/WaterDi",
                name: "WaterDi",
                component: resolve => require(["../modules/admin/water/di/DataRIU"], resolve),
                meta: {
                    title: '供水数据调查任务数据入库记录'
                }
            },

            {
                path: "/GasTl",
                name: "GasTl",
                component: resolve => require(["../modules/admin/gas/tl/Tl"], resolve),
                meta: {
                    title: '燃气数据调查首页'
                }
            },
            {
                path: "/GasNewMission",
                name: "GasNewMission",
                component: resolve => require(["../modules/admin/gas/tl/NewMission"], resolve),
                meta: {
                    title: '发布燃气数据调查任务'
                }
            },
            {
                path: "/GasNode",
                name: "GasNode",
                component: resolve => require(["../modules/admin/gas/tl/Node"], resolve),
                meta: {
                    title: '燃气数据调查任务调查点数据'
                }
            },
            {
                path: "/GasHistory",
                name: "GasHistory",
                component: resolve => require(["../modules/admin/gas/tl/HistoryList"], resolve),
                meta: {
                    title: '燃气数据调查任务数据上传历史'
                }
            },
            {
                path: "/GasQc",
                name: "GasQc",
                component: resolve => require(["../modules/admin/gas/qc/DataQuality"], resolve),
                meta: {
                    title: '燃气数据调查任务数据质检页'
                }
            },
            {
                path: "/GasDoorstationQc",
                name: "GasDoorstationQc",
                component: resolve => require(["../modules/admin/gas/qc/GasDoorstationQc"], resolve),
                meta: {
                    title: '燃气门站数据'
                }
            },
            {
                path: "/GasStoraneboxQc",
                name: "GasStoraneboxQc",
                component: resolve => require(["../modules/admin/gas/qc/GasStoraneboxQc"], resolve),
                meta: {
                    title: '储气罐数据'
                }
            },
            {
                path: "/GasDi",
                name: "GasDi",
                component: resolve => require(["../modules/admin/gas/di/DataRIU"], resolve),
                meta: {
                    title: '燃气数据调查任务数据入库记录'
                }
            },

            {
                path: "/TrafficTl",
                name: "TrafficTl",
                component: resolve => require(["../modules/admin/traffic/tl/Tl"], resolve),
                meta: {
                    title: '交通数据调查首页'
                }
            },
            {
                path: "/TrafficNewMission",
                name: "TrafficNewMission",
                component: resolve => require(["../modules/admin/traffic/tl/NewMission"], resolve),
                meta: {
                    title: '发布交通数据调查任务'
                }
            },
            {
                path: "/TrafficNode",
                name: "TrafficNode",
                component: resolve => require(["../modules/admin/traffic/tl/Node"], resolve),
                meta: {
                    title: '交通数据调查任务调查点数据'
                }
            },
            {
                path: "/TrafficHistory",
                name: "TrafficHistory",
                component: resolve => require(["../modules/admin/traffic/tl/HistoryList"], resolve),
                meta: {
                    title: '交通数据调查任务数据上传历史'
                }
            },
            {
                path: "/TrafficQc",
                name: "TrafficQc",
                component: resolve => require(["../modules/admin/traffic/qc/DataQuality"], resolve),
                meta: {
                    title: '交通数据调查任务数据质检页'
                }
            },
            {
                path: "/TrafficBridgeQc",
                name: "TrafficBridgeQc",
                component: resolve => require(["../modules/admin/traffic/qc/TrafficBridgeQc"], resolve),
                meta: {
                    title: '桥梁数据'
                }
            },
            {
                path: "/TrafficDi",
                name: "TrafficDi",
                component: resolve => require(["../modules/admin/traffic/di/DataRIU"], resolve),
                meta: {
                    title: '交通数据调查任务调查点数据'
                }
            },

            {
                path: "/ElectricityTl",
                name: "ElectricityTl",
                component: resolve => require(["../modules/admin/electricity/tl/Tl"], resolve),
                meta: {
                    title: '供电数据调查首页'
                }
            },
            {
                path: "/ElectricityNewMission",
                name: "ElectricityNewMission",
                component: resolve => require(["../modules/admin/electricity/tl/NewMission"], resolve),
                meta: {
                    title: '发布供电数据调查任务'
                }
            },
            {
                path: "/ElectricityNode",
                name: "ElectricityNode",
                component: resolve => require(["../modules/admin/electricity/tl/Node"], resolve),
                meta: {
                    title: '供电数据调查任务调查点数据'
                }
            },
            {
                path: "/ElectricityHistory",
                name: "ElectricityHistory",
                component: resolve => require(["../modules/admin/electricity/tl/HistoryList"], resolve),
                meta: {
                    title: '供电数调查任务数据上传记录'
                }
            },
            {
                path: "/ElectricityQc",
                name: "ElectricityQc",
                component: resolve => require(["../modules/admin/electricity/qc/DataQuality"], resolve),
                meta: {
                    title: '供电数据调查任务数据质检页'
                }
            },
            {
                path: "/ElectricityHourseQc",
                name: "ElectricityHourseQc",
                component: resolve => require(["../modules/admin/electricity/qc/ElectricityHourseQc"], resolve),
                meta: {
                    title: '发电厂房数据'
                }
            },
            {
                path: "/ElectricityStationQc",
                name: "ElectricityStationQc",
                component: resolve => require(["../modules/admin/electricity/qc/ElectricityStationQc"], resolve),
                meta: {
                    title: '变电站数据'
                }
            },
            {
                path: "/ElectricityDi",
                name: "ElectricityDi",
                component: resolve => require(["../modules/admin/electricity/di/DataRIU"], resolve),
                meta: {
                    title: '供电数据调查任务数据入库记录'
                }
            },

            {
                path: "/CorrespondTl",
                name: "CorrespondTl",
                component: resolve => require(["../modules/admin/correspond/tl/Tl"], resolve),
                meta: {
                    title: '通信数据调查首页'
                }
            },
            {
                path: "/CorrespondNewMission",
                name: "CorrespondNewMission",
                component: resolve => require(["../modules/admin/correspond/tl/NewMission"], resolve),
                meta: {
                    title: '发布通信数据调查任务'
                }
            },
            {
                path: "/CorrespondNode",
                name: "CorrespondNode",
                component: resolve => require(["../modules/admin/correspond/tl/Node"], resolve),
                meta: {
                    title: '通信数据调查任务调查点数据'
                }
            },
            {
                path: "/CorrespondHistory",
                name: "CorrespondHistory",
                component: resolve => require(["../modules/admin/correspond/tl/HistoryList"], resolve),
                meta: {
                    title: '通信数据调查任务数据上传历史记录'
                }
            },
            {
                path: "/CorrespondQc",
                name: "CorrespondQc",
                component: resolve => require(["../modules/admin/correspond/qc/DataQuality"], resolve),
                meta: {
                    title: '通信数据调查任务数据质检页'
                }
            },
            {
                path: "/CorrespondBuildingQc",
                name: "CorrespondBuildingQc",
                component: resolve => require(["../modules/admin/correspond/qc/CorrespondBuildingQc"], resolve),
                meta: {
                    title: '通信重要建筑物数据'
                }
            },
            {
                path: "/CorrespondEquipmentQc",
                name: "CorrespondEquipmentQc",
                component: resolve => require(["../modules/admin/correspond/qc/CorrespondEquipmentQc"], resolve),
                meta: {
                    title: '通信室内设备数据'
                }
            },
            {
                path: "/CorrespondTowerQc",
                name: "CorrespondTowerQc",
                component: resolve => require(["../modules/admin/correspond/qc/CorrespondTowerQc"], resolve),
                meta: {
                    title: '通信电视塔数据'
                }
            },
            {
                path: "/CorrespondDi",
                name: "CorrespondDi",
                component: resolve => require(["../modules/admin/correspond/di/DataRIU"], resolve),
                meta: {
                    title: '通信数据调查任务数据入库记录'
                }
            },
            {
                path: 'UserMain',
                name: 'UserMain',
                component: resolve => require(["../modules/admin/user/Main"], resolve),
                meta: {
                    title: '用户管理页'
                }
            },
            {
                path: 'UserLog',
                name: 'UserLog',
                component: resolve => require(["../modules/admin/userLog/UserLog"], resolve),
                meta: {
                    title: '任务日志'
                }
            },
            {
                path: 'Settings',
                name: 'Settings',
                component: resolve => require(["../modules/admin/settings/SystemSettings"], resolve),
                meta: {
                    title: '系统配置'
                }
            }
        ]
    }
];

const router = new VueRouter({
    mode: "hash",
    base: process.env.BASE_URL,
    routes
});

export default router;
